<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Class template years_duration</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../date_time/doxy.html#doxygen.date_time_reference.date__duration__types_8hpp" title="Header &lt;boost/date_time/date_duration_types.hpp&gt;">
<link rel="prev" href="classboost_1_1date__time_1_1weeks__duration.html" title="Class template weeks_duration">
<link rel="next" href="date__duration__types_8hpp_1a1b682e5770704817b0533ea7681271f5.html" title="Global years_duration">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="classboost_1_1date__time_1_1weeks__duration.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../date_time/doxy.html#doxygen.date_time_reference.date__duration__types_8hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="date__duration__types_8hpp_1a1b682e5770704817b0533ea7681271f5.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class template years_duration</span></h2>
<p>boost::date_time::years_duration — additional duration type that represents a logical year </p>
</div>
<h2 class="refsynopsisdiv-title">Synopsis</h2>
<div class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../date_time/doxy.html#doxygen.date_time_reference.date__duration__types_8hpp" title="Header &lt;boost/date_time/date_duration_types.hpp&gt;">boost/date_time/date_duration_types.hpp</a>&gt;

</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> base_config<span class="special">&gt;</span> 
<span class="keyword">class</span> <a class="link" href="classboost_1_1date__time_1_1years__duration.html" title="Class template years_duration">years_duration</a> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>

  <span class="comment">// <a class="link" href="classboost_1_1date__time_1_1years__duration.html#id-1_3_11_15_3_11_1_1_3_4-bb">public member functions</a></span>
  <a class="link" href="classboost_1_1date__time_1_1years__duration.html#doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1a8ba2af98fb27b95fa557119f8e9e4f02"><span class="identifier">years_duration</span></a><span class="special">(</span><span class="identifier">int_rep</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="classboost_1_1date__time_1_1years__duration.html#doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1aa944bfbab068c38172dc3c2cb4af61b1"><span class="identifier">years_duration</span></a><span class="special">(</span><span class="identifier">special_values</span><span class="special">)</span><span class="special">;</span>
  <span class="identifier">BOOST_CXX14_CONSTEXPR</span> <span class="identifier">int_rep</span> <a class="link" href="classboost_1_1date__time_1_1years__duration.html#doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1aac6ec05ec79f4d29dcac2cbc8a41522d"><span class="identifier">number_of_years</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">BOOST_CXX14_CONSTEXPR</span> <span class="identifier">duration_type</span> <a class="link" href="classboost_1_1date__time_1_1years__duration.html#doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1af5350bba6765542df20ec7784e24344d"><span class="identifier">get_neg_offset</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">date_type</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">BOOST_CXX14_CONSTEXPR</span> <span class="identifier">duration_type</span> <a class="link" href="classboost_1_1date__time_1_1years__duration.html#doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1a66f73602422bcaadc246362c50eff542"><span class="identifier">get_offset</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">date_type</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">BOOST_CXX14_CONSTEXPR</span> <span class="keyword">bool</span> <a class="link" href="classboost_1_1date__time_1_1years__duration.html#doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1abf823ee24421ba9edd0af690d43c7086"><span class="keyword">operator</span><span class="special">==</span></a><span class="special">(</span><span class="keyword">const</span> years_type <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">bool</span> <a class="link" href="classboost_1_1date__time_1_1years__duration.html#doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1a70912dea6a4d7cfce5241ed2871f5bb8"><span class="keyword">operator</span><span class="special">!=</span></a><span class="special">(</span><span class="keyword">const</span> years_type <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">BOOST_CXX14_CONSTEXPR</span> years_type <a class="link" href="classboost_1_1date__time_1_1years__duration.html#doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1a2db971651e91751b844c5890f5758c83"><span class="keyword">operator</span><span class="special">+</span></a><span class="special">(</span><span class="keyword">const</span> years_type <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">BOOST_CXX14_CONSTEXPR</span> years_type <span class="special">&amp;</span> <a class="link" href="classboost_1_1date__time_1_1years__duration.html#doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1a0cfe1e8f6ed1a2efef0eb1b868f9277c"><span class="keyword">operator</span><span class="special">+=</span></a><span class="special">(</span><span class="keyword">const</span> years_type <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="identifier">BOOST_CXX14_CONSTEXPR</span> years_type <a class="link" href="classboost_1_1date__time_1_1years__duration.html#doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1a41a74447af37b2da15f3ba13d2e01abb"><span class="keyword">operator</span><span class="special">-</span></a><span class="special">(</span><span class="keyword">const</span> years_type <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">BOOST_CXX14_CONSTEXPR</span> years_type <span class="special">&amp;</span> <a class="link" href="classboost_1_1date__time_1_1years__duration.html#doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1a527cf98e5d0b84ea14601f12cc946097"><span class="keyword">operator</span><span class="special">-=</span></a><span class="special">(</span><span class="keyword">const</span> years_type <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="identifier">BOOST_CXX14_CONSTEXPR</span> years_type <a class="link" href="classboost_1_1date__time_1_1years__duration.html#doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1aecf23e6aa643e37356f5b626fcb58aaa"><span class="keyword">operator</span><span class="special">*</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">int_type</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">BOOST_CXX14_CONSTEXPR</span> years_type <span class="special">&amp;</span> <a class="link" href="classboost_1_1date__time_1_1years__duration.html#doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1a50f89dd2486daeb647ce8912c868317f"><span class="keyword">operator</span><span class="special">*=</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">int_type</span><span class="special">)</span><span class="special">;</span>
  <span class="identifier">BOOST_CXX14_CONSTEXPR</span> years_type <a class="link" href="classboost_1_1date__time_1_1years__duration.html#doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1a689f1e58fa3afd93e979f22960c7a290"><span class="keyword">operator</span><span class="special">/</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">int_type</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">BOOST_CXX14_CONSTEXPR</span> years_type <span class="special">&amp;</span> <a class="link" href="classboost_1_1date__time_1_1years__duration.html#doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1a832592a47707f564d87d92b85c49d296"><span class="keyword">operator</span><span class="special">/=</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">int_type</span><span class="special">)</span><span class="special">;</span>
  <span class="identifier">BOOST_CXX14_CONSTEXPR</span> months_type <a class="link" href="classboost_1_1date__time_1_1years__duration.html#doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1af7af3ad0588f0ca438fbdc069aa34173"><span class="keyword">operator</span><span class="special">+</span></a><span class="special">(</span><span class="keyword">const</span> months_type <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">BOOST_CXX14_CONSTEXPR</span> months_type <a class="link" href="classboost_1_1date__time_1_1years__duration.html#doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1a14a302eb60037f6abbca3bbc81807243"><span class="keyword">operator</span><span class="special">-</span></a><span class="special">(</span><span class="keyword">const</span> months_type <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="id-1.3.11.15.3.11.5.4"></a><h2>Description</h2>
<p>A logical year enables things like: "date(2002,Mar,2) + years(2) -&gt; 
2004-Mar-2". If the date is a last day-of-the-month, the result will also be a last-day-of-the-month (ie date(2001-Feb-28) + years(3) -&gt; 2004-Feb-29). </p>
<div class="refsect2">
<a name="id-1.3.11.15.3.11.5.4.3"></a><h3>
<a name="id-1_3_11_15_3_11_1_1_3_4-bb"></a><code class="computeroutput">years_duration</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><pre class="literallayout"><a name="doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1a8ba2af98fb27b95fa557119f8e9e4f02"></a><span class="identifier">years_duration</span><span class="special">(</span><span class="identifier">int_rep</span> num<span class="special">)</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><a name="doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1aa944bfbab068c38172dc3c2cb4af61b1"></a><span class="identifier">years_duration</span><span class="special">(</span><span class="identifier">special_values</span> sv<span class="special">)</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="identifier">BOOST_CXX14_CONSTEXPR</span> <span class="identifier">int_rep</span> <a name="doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1aac6ec05ec79f4d29dcac2cbc8a41522d"></a><span class="identifier">number_of_years</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre></li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">BOOST_CXX14_CONSTEXPR</span> <span class="identifier">duration_type</span> <a name="doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1af5350bba6765542df20ec7784e24344d"></a><span class="identifier">get_neg_offset</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">date_type</span> <span class="special">&amp;</span> d<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>returns a negative duration </li>
<li class="listitem"><pre class="literallayout"><span class="identifier">BOOST_CXX14_CONSTEXPR</span> <span class="identifier">duration_type</span> <a name="doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1a66f73602422bcaadc246362c50eff542"></a><span class="identifier">get_offset</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">date_type</span> <span class="special">&amp;</span> d<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="identifier">BOOST_CXX14_CONSTEXPR</span> <span class="keyword">bool</span> <a name="doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1abf823ee24421ba9edd0af690d43c7086"></a><span class="keyword">operator</span><span class="special">==</span><span class="special">(</span><span class="keyword">const</span> years_type <span class="special">&amp;</span> rhs<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="keyword">bool</span> <a name="doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1a70912dea6a4d7cfce5241ed2871f5bb8"></a><span class="keyword">operator</span><span class="special">!=</span><span class="special">(</span><span class="keyword">const</span> years_type <span class="special">&amp;</span> rhs<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="identifier">BOOST_CXX14_CONSTEXPR</span> years_type <a name="doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1a2db971651e91751b844c5890f5758c83"></a><span class="keyword">operator</span><span class="special">+</span><span class="special">(</span><span class="keyword">const</span> years_type <span class="special">&amp;</span> rhs<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="identifier">BOOST_CXX14_CONSTEXPR</span> years_type <span class="special">&amp;</span> <a name="doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1a0cfe1e8f6ed1a2efef0eb1b868f9277c"></a><span class="keyword">operator</span><span class="special">+=</span><span class="special">(</span><span class="keyword">const</span> years_type <span class="special">&amp;</span> rhs<span class="special">)</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="identifier">BOOST_CXX14_CONSTEXPR</span> years_type <a name="doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1a41a74447af37b2da15f3ba13d2e01abb"></a><span class="keyword">operator</span><span class="special">-</span><span class="special">(</span><span class="keyword">const</span> years_type <span class="special">&amp;</span> rhs<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="identifier">BOOST_CXX14_CONSTEXPR</span> years_type <span class="special">&amp;</span> <a name="doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1a527cf98e5d0b84ea14601f12cc946097"></a><span class="keyword">operator</span><span class="special">-=</span><span class="special">(</span><span class="keyword">const</span> years_type <span class="special">&amp;</span> rhs<span class="special">)</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="identifier">BOOST_CXX14_CONSTEXPR</span> years_type <a name="doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1aecf23e6aa643e37356f5b626fcb58aaa"></a><span class="keyword">operator</span><span class="special">*</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">int_type</span> rhs<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="identifier">BOOST_CXX14_CONSTEXPR</span> years_type <span class="special">&amp;</span> <a name="doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1a50f89dd2486daeb647ce8912c868317f"></a><span class="keyword">operator</span><span class="special">*=</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">int_type</span> rhs<span class="special">)</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="identifier">BOOST_CXX14_CONSTEXPR</span> years_type <a name="doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1a689f1e58fa3afd93e979f22960c7a290"></a><span class="keyword">operator</span><span class="special">/</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">int_type</span> rhs<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="identifier">BOOST_CXX14_CONSTEXPR</span> years_type <span class="special">&amp;</span> <a name="doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1a832592a47707f564d87d92b85c49d296"></a><span class="keyword">operator</span><span class="special">/=</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">int_type</span> rhs<span class="special">)</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="identifier">BOOST_CXX14_CONSTEXPR</span> months_type <a name="doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1af7af3ad0588f0ca438fbdc069aa34173"></a><span class="keyword">operator</span><span class="special">+</span><span class="special">(</span><span class="keyword">const</span> months_type <span class="special">&amp;</span> m<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="identifier">BOOST_CXX14_CONSTEXPR</span> months_type <a name="doxygen.date_time_reference.classboost_1_1date__time_1_1years__duration_1a14a302eb60037f6abbca3bbc81807243"></a><span class="keyword">operator</span><span class="special">-</span><span class="special">(</span><span class="keyword">const</span> months_type <span class="special">&amp;</span> m<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre></li>
</ol></div>
</div>
</div>
</div>
<div class="copyright-footer">Copyright © 2001-2005 CrystalClear Software, Inc<p>Subject to the Boost Software License, Version 1.0. (See accompanying file
    <code class="filename">LICENSE_1_0.txt</code> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)</p>
</div>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="classboost_1_1date__time_1_1weeks__duration.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../date_time/doxy.html#doxygen.date_time_reference.date__duration__types_8hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="date__duration__types_8hpp_1a1b682e5770704817b0533ea7681271f5.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
